<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="referrer" content="never">
    <title>入口函数</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }
    </style>
    <script src="../lib/jquery/jquery.min.js"></script>
    <script>
        window.onload = function (){
            // 页面内容加载完成后执行的回调函数
            console.log("2", document.querySelector(".box")); // box
        }

        $(function (){
            // 作用与 window.onload 一致
            // 1. 优先于window.onload执行  2. 可以写多个
            console.log("1", document.querySelector(".box")); // box
        })

        $(function (){
            console.log("hello world");
        })

        $(document).ready(function (){
            console.log("页面加载完成后执行");
        })
        
    </script>
</head>
<body>
    <div class="box"></div>

    
    <script type="text/javascript">
        // $(selector/fn)   selector:意味着选择元素，返回一个 jQ 对象；fn: 页面入口函数

        
    </script>
</body>
</html>